<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/9/5
  Time: 15:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>图书管理</title>
    <%@ include file="/common/head.jsp"%>
    <script type="text/javascript">
        $(function () {
            $("a.deleteClass").click(function () {
                //查找当前对象的的父元素的父元素的第一个子元素
                var text = $(this).parent().parent().find("td:first").text();
                /**confirm:确定提示框函数
                 * 参数是提示内容，它有两个按钮，确定，取消，
                 * 点击确定按键返回true;点击取消按键返回false;
                 * return true;//函数执行
                 * return false;//函数不执行
                 */
                return confirm("确定删除《"+text+"》吗？");
            })
        })
    </script>
</head>
<body>
<div class="TieleStyle" align="center">
    <h1>游戏类图书管理界面</h1>
</div>
<div align="right">
    <font color="red" face="楷体" size="3">
        <%@include file="/common/managerMenu.jsp"%>
    </font>
</div>
<hr>
<table border="0" align="center" width="70%">
    <tr>
        <th>名称</th>
        <th>价格$</th>
        <th>作者</th>
        <th>销量</th>
        <th>库存</th>
        <th colspan="2">操作</th>
    </tr>
    <tr>
        <td colspan="7">
            <hr>
        </td>
    </tr>
    <c:forEach items="${requestScope.page.items}" var="book">
        <tr>
            <td align="center">${book.name}</td>
            <td align="center">${book.price}</td>
            <td align="center">${book.author}</td>
            <td align="center">${book.sales}</td>
            <td align="center">${book.stock}</td>
            <td align="center"><a href="manager/bs?action=getBook&id=${book.id}&pageNo=${requestScope.page.pageNo}" style="color: aquamarine">修改</a></td>
            <td align="center"><a class="deleteClass" href="manager/bs?action=delete&id=${book.id}&pageNo=${requestScope.page.pageNo}" style="color: red;text-decoration: none">删除</a></td>
        </tr>
        <tr>
            <td colspan="7">
                <hr>
            </td>
        </tr>
    </c:forEach>
</table>

<%--静态包含，用公共分页条--%>
<%@include file="/common/paging_bar.jsp"%>


<div align="right">
    <a href="pages/ManagerPages/c_manager_book_edit.jsp?pageNo=${requestScope.page.pageTotal+1}" style="color: deepskyblue;text-decoration: none;">
        添加图书
    </a>
</div>
</body>
</html>
